<!-- TODO: szc -->
<script setup>
/**
 * @libs
 */
import { nextTick, ref } from 'vue'

/**
 * @data
 */
let compMess = ref({
  'exploreMore-left': {
    "bgImg": "img_1.png",
    "title": "豪华天堂",
    "content": "每一个细节都是为了给您最舒适的体验,我们一直在改进我们的服务质量,让您尽享最舒心的购物体验！！！",
    "buttonText": "探索更多",
    "link": $szcyydsUrl,
    //是否新标签跳转
    "isNewTab": false,
  },
  'exploreMore-right': {
    "bgImg": "img_2.png",
    "title": "豪华天堂",
    "content": "每一个细节都是为了给您最舒适的体验,我们一直在改进我们的服务质量,让您尽享最舒心的购物体验！！！",
    "buttonText": "探索更多",
    "link": $szcyydsUrl,
    //是否新标签跳转
    "isNewTab": false,
  },
})

const quickViewText = ref("快速预览")


/**
 * 返回指定文件夹下的图片路径
 * @param {String} name 图片名称
 * @returns {String} 图片路径
 */
let getImgUrl = (name) => {
  return new URL(`/src/assets/images/mainImgs/homeImgs/part_8_imgs/${name}`, import.meta.url).href
}

/**
 * 返回探索更多动态样式类
 * @param {String} key 键名
 * @returns {Object}
 */
let exportMoreBgClass = (key) => {
  return {
    backgroundImage: `url(${getImgUrl(compMess.value[key].bgImg)})`,
    backgroundSize: "cover",
    backgroundPosition: "center",
    backgroundRepeat: "no-repeat",
  }
}

/**
 * 链接跳转事件
 * @param {Boolean} isNewTab 是否新标签跳转
 * @param {String} link 链接地址
 */
let gotoNavtion = (isNewTab, link) => {
  if (isNewTab) {
    window.open(link)
  } else {
    window.location.href = link
  }
}

/**
 * 探索更多按钮点击事件
 * @param {String} key 键名
 */
let exportMoreButtonEvent = (key) => {
  gotoNavtion(compMess.value[key].isNewTab, compMess.value[key].link)
}

</script>
<template>
  <div class="part-8-class">
    <div class="part-8-explore-more-left" :style="exportMoreBgClass('exploreMore-left')">
      <div class="part-8-explore-more-title-left">{{ compMess['exploreMore-left'].title }}</div>
      <div class="part-8-explore-more-content-left">{{ compMess['exploreMore-left'].content }}</div>
      <div class="part-8-explore-more-btn-left" @click="exportMoreButtonEvent('exploreMore-left')">{{
        compMess['exploreMore-left'].buttonText }}</div>
    </div>
    <div class="part-8-explore-more-right" :style="exportMoreBgClass('exploreMore-right')">
      <div class="part-8-explore-more-title-right">{{ compMess['exploreMore-right'].title }}</div>
      <div class="part-8-explore-more-content-right">{{ compMess['exploreMore-right'].content }}</div>
      <div class="part-8-explore-more-btn-right" @click="exportMoreButtonEvent('exploreMore-right')">{{
        compMess['exploreMore-right'].buttonText }}</div>
    </div>
  </div>
</template>
<style scoped>
.part-8-class {
  width: 14rem;
  margin: 0 auto;
  height: 4.20rem;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  cursor: pointer;
  margin-top: 1rem;
}

/* 公共样式 */
.part-8-explore-more-left,
.part-8-explore-more-right {
  height: 4.20rem;
  width: 6.80rem;
  border-radius: 0.32rem;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* .part-8-explore-more-right{
  /* margin-left: 0.4rem; 
} */
.part-8-explore-more-title-left,
.part-8-explore-more-title-right {
  /* position: absolute; */
  width: 1.75rem;
  height: 0.36rem;
  margin-top: 0.60rem;
  margin-left: 0.60rem;
  font-weight: 500;
  font-size: 0.24rem;
  line-height: 0.36rem;
  color: #000000;
}
.part-8-explore-more-content-left,
.part-8-explore-more-content-right {
  margin-top: 0.15rem;
  margin-left: 0.6rem;
  width: 3.52rem;
  height: 0.48rem;
  opacity: 0.8;
  font-weight: 300;
  font-size: 0.16rem;
  line-height: 0.24rem;
  color: #000000;
  /* 超出部分隐藏 */
  overflow: hidden;
  /* 超出两行则省略号 */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  /* 限制显示两行 */
  -webkit-box-orient: vertical;
  /* 设置为垂直排列 */
  line-clamp: 2;
  /* 添加标准属性 */
}
.part-8-explore-more-btn-left,
.part-8-explore-more-btn-right {
  width: 1.50rem;
  height: 0.40rem;
  margin-top: 1.65rem;
  margin-left: 0.60rem;
  border-radius: 0.4rem;
  background-color: #fff;
  border: #fff solid 0.01rem;
  font-weight: 400;
  font-size: 0.16rem;
  color: black;
  text-align: center;
  line-height: calc(0.40rem - 0.02rem);
}

</style>